package com.wolfpire.workflow.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.wolfpire.system.common.base.dao.impl.BaseHibernateDao;
import com.wolfpire.workflow.dao.ConsignDao;
import com.wolfpire.workflow.om.Consign;

@Repository
public class ConsignDaoImpl extends BaseHibernateDao<Consign, Long> implements ConsignDao {
	
	/**
	 * 查询委托给我的流程列表
	 * @param userId
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<Consign> queryMyConsignList(Long userId){
		Criteria criteria = createCriteria(
				Restrictions.eq("consignUserId", userId),
				Restrictions.or(Restrictions.eq("status", "0"), Restrictions.eq("status", "1")));
		return criteria.list();
	}
	
}
